package com.tianzehua.thrift;

import org.apache.thrift.TException;
import thrift.generated.DataException;
import thrift.generated.Person;
import thrift.generated.PersonService;

/**
 * PersonService Impl Class {@link PersonService.Iface}
 * @author tianzehua
 * @date  2019/03/16
 */
public class PersonSericeImpl implements PersonService.Iface {
    @Override
    public Person getPersonByUsename(String username) throws DataException, TException {
        System.out.println("Got Client Param :" + username);

        Person person = new Person();
        person.setUsername(username);
        person.setAge(20);
        person.setMarried(false);
        return person;
    }

    @Override
    public void savePerson(Person person) throws DataException, TException {
        System.out.println(person.getUsername());
        System.out.println(person.getAge());
        System.out.println(person.isMarried());
    }
}
